package com.example.demoamqp.receiver;

import cn.hutool.core.date.DateUtil;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @className: DeadLetterQueueReceiver
 * @projectName: demo-one
 * @auth: rosszhang
 * @date: 2023/12/28 18:17
 */
@Slf4j
@Component
public class MqDeadLetterQueueReceiver {

    /**
     * 消费者QD接收消息
     */
    @RabbitListener(queues = "QD")
    public void receiveD(Message message, Channel channel) {
        String msg = new String(message.getBody());
        log.info("当前时间：{}，收到死信队列的消息：{}", DateUtil.date(), msg);
    }
}
